import axios from './axios';

const server = window.server;
const post = function (api, param, successFunc, errorFunc) {
  axios.post(server + api, param || {})
    .then(successFunc)
    .catch((error) => {
      console.error(error);
      if (errorFunc) {
        errorFunc();
      }
    });
};
const api = {
  device: {
    getStatus({applianceId, userId}, success, error) {
      post('pressure/getStatus', {
        applianceId,
        userId
      }, success, error);
    },
  },
};

export default api;
